/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kotionokyurievna.gmail.com.genproj.logic;

/**
 *
 * @author Kateryna_Reznik
 */
public class RedApple extends Apple{
    
    private boolean ready;
    private AppleColor color;

    public RedApple(){
        setColor(color.GREEN);
        setType("Red apple");
    }
    
    public RedApple( int size ){
        setSize(size);
        setColor(color.GREEN);
        setType("Red apple");
    }
    
   public RedApple( AppleColor color,  int size  ){
        setSize(size);
        setColor(color);
        setType("Red apple");
    }
    
    public boolean isReady() {
        return ready;
    }
    
    public AppleColor getColor() {
        return color;
    }

    public void setColor(AppleColor color) {
        this.color = color;
        if ( color.equals(AppleColor.RED) ){
            ready = true;
        }
        else{
            ready = false;
        }
    }
    
    public boolean equals( Object obj ){
        
        if ( super.equals(obj) && getClass() == obj.getClass() ){
            RedApple other = (RedApple) obj;
            return (color.equals(other.color)) && (ready == other.ready);
	}
        return false;
    }
    
    public String toString(){
        return super.toString() + ", [ color = " + getColor() + " ]";
    }
    
    
}
